/*******************************************************************************
* 
* LibraryLoader for 3 different ways
* 
* 
******************************************************************************/
#include "loader.h"
#include "logging.h"
#include <atlbase.h>

using namespace std;
using namespace noria::diagnostic;

namespace noria{ namespace engine
{
    // LibraryLoader
    LibraryLoader::LibraryLoader(void)
    {
    }

    LibraryLoader::~LibraryLoader(void)
    {
    }


    // ComLoader
    ComLoader::ComLoader(void)
    {
    }

    ComLoader::~ComLoader(void)
    {
    }

    pointer ComLoader::getProcAddr(const wchar_t* lib, const char* func)
    {
        return NULL;
    }

    pointer ComLoader::createComObject(const wchar_t* lib, const _GUID& clsid, const _GUID& iid)
    {
        pointer ptr = NULL;
        HRESULT hr = CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER, iid, &ptr);
        if(FAILED(hr))
        {
            LOG_FATAL("Failure calling CoCreateInstance. error=%#X", hr);
        }
        return ptr;
    }


    // IsolatedLoader
    IsolatedLoader::IsolatedLoader(void)
    {
    }

    IsolatedLoader::~IsolatedLoader(void)
    {
    }

    pointer IsolatedLoader::getProcAddr(const wchar_t* lib, const char* func)
    {
        return NULL;
    }

    pointer IsolatedLoader::createComObject(const wchar_t* lib, const _GUID& clsid, const _GUID& iid)
    {
        return NULL;
    }


    // MemoryLoader
    MemoryLoader::MemoryLoader(ResourceManager* res)
        : m_res(res)
    {
    }

    MemoryLoader::~MemoryLoader(void)
    {
    }

    pointer MemoryLoader::getProcAddr(const wchar_t* lib, const char* func)
    {
        return NULL;
    }

    pointer MemoryLoader::createComObject(const wchar_t* lib, const _GUID& clsid, const _GUID& iid)
    {
        return NULL;
    }

}}